package com.mach.platform.api.repository;


import com.mach.platform.api.domain.BillDetails;
import com.mach.platform.repository.BaseRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;

@Repository
public interface BillDetailsRepo extends BaseRepository<BillDetails> {

    @Query(value = "select * from bill_details where bill_id = ?1", nativeQuery = true)
    ArrayList<BillDetails> getListByBillId(Long id);

    @Modifying
    @Transactional
    @Query(value = "delete from bill_details where bill_id in (?1)", nativeQuery = true)
    void deleteByBillId(Long[] ids);
}
